﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Threading;
using SharePointExplorer.SharePoint;
using Microsoft.SharePoint.Client;
using SharePointExplorer.Classes;
using FluidKit.Controls;
using System.Configuration;

namespace SharePointExplorer.UserControls
{
    /// <summary>
    /// Interaction logic for SharePointLocator.xaml
    /// </summary>
    public partial class SharePointLocator : UserControl
    {
        App CurrentApplication = (App)Application.Current;
        public SharePointLocator()
        {
            InitializeComponent();
            CurrentApplication.MainWindowInstance.txtURLHeader.Visibility = Visibility.Collapsed;
            CurrentApplication.MainWindowInstance.StartOverButton.Visibility = Visibility.Collapsed;
            CurrentApplication.MainWindowInstance.txtCurrentURL.Visibility = Visibility.Collapsed;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //var result = SharePointHelper.Authenticate(SharePointUrl: "http://tendulkar-pc",UserName:"tendulkar",Password:"abcd@12345");
            var result = SharePointHelper.Authenticate(SharePointUrl: ConfigurationManager.AppSettings["SharePointURL"].ToString());
            if (result)
            {
                NavigationManager nm = new NavigationManager();
                nm.NavigateContent(this, new Dashboard(), Direction.RightToLeft);
            }
        }
    }


}
